package com.yun.workqueue;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.yun.utils.ConnectionUtil;
import org.junit.Test;

import java.io.IOException;

public class Provider {

    @Test
    public void workqueue() throws IOException {

        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare("work",false,false,false,null);

        for (int i = 0; i < 30; i++) {
            channel.basicPublish("","work",null,(i+"work 发送消息").getBytes());
        }
        ConnectionUtil.close(connection,channel);
    }
}
